package o;

import androidx.annotation.NonNull;
import java.io.File;
import java.util.List;
import o.sg.d;
import o.tg.a;
import o.vk.c;

class ty implements tg, d<Object> {
    private volatile c<?> ʻ;
    private int ʼ;
    private List<vk<File, ?>> ʽ;
    private int ˊ = -1;
    private final tj<?> ˋ;
    private int ˎ;
    private sa ˏ;
    private final a ॱ;
    private File ॱॱ;
    private tu ᐝ;

    ty(tj<?> tjVar, a aVar) {
        this.ˋ = tjVar;
        this.ॱ = aVar;
    }

    public boolean ˎ() {
        List ͺ = this.ˋ.ͺ();
        if (ͺ.isEmpty()) {
            return false;
        }
        List ˊॱ = this.ˋ.ˊॱ();
        if (!ˊॱ.isEmpty()) {
            while (true) {
                if (this.ʽ != null && ˋ()) {
                    break;
                }
                this.ˊ++;
                if (this.ˊ >= ˊॱ.size()) {
                    this.ˎ++;
                    if (this.ˎ >= ͺ.size()) {
                        return false;
                    }
                    this.ˊ = 0;
                }
                sa saVar = (sa) ͺ.get(this.ˎ);
                Class cls = (Class) ˊॱ.get(this.ˊ);
                this.ᐝ = new tu(this.ˋ.ॱॱ(), saVar, this.ˋ.ʼ(), this.ˋ.ᐝ(), this.ˋ.ʽ(), this.ˋ.ˋ(cls), cls, this.ˋ.ˊ());
                this.ॱॱ = this.ˋ.ˋ().ˋ(this.ᐝ);
                if (this.ॱॱ != null) {
                    this.ˏ = saVar;
                    this.ʽ = this.ˋ.ˎ(this.ॱॱ);
                    this.ʼ = 0;
                }
            }
            this.ʻ = null;
            boolean z = false;
            while (!z && ˋ()) {
                boolean z2;
                List list = this.ʽ;
                int i = this.ʼ;
                this.ʼ = i + 1;
                this.ʻ = ((vk) list.get(i)).ˎ(this.ॱॱ, this.ˋ.ᐝ(), this.ˋ.ʽ(), this.ˋ.ˊ());
                if (this.ʻ == null || !this.ˋ.ˊ(this.ʻ.ˎ.ˋ())) {
                    z2 = z;
                } else {
                    z2 = true;
                    this.ʻ.ˎ.ˏ(this.ˋ.ˎ(), this);
                }
                z = z2;
            }
            return z;
        } else if (File.class.equals(this.ˋ.ʻ())) {
            return false;
        } else {
            throw new IllegalStateException("Failed to find any load path from " + this.ˋ.ˏॱ() + " to " + this.ˋ.ʻ());
        }
    }

    private boolean ˋ() {
        return this.ʼ < this.ʽ.size();
    }

    public void ˏ() {
        c cVar = this.ʻ;
        if (cVar != null) {
            cVar.ˎ.ॱ();
        }
    }

    public void ॱ(Object obj) {
        this.ॱ.ˏ(this.ˏ, obj, this.ʻ.ˎ, rz.RESOURCE_DISK_CACHE, this.ᐝ);
    }

    public void ˏ(@NonNull Exception exception) {
        this.ॱ.ˋ(this.ᐝ, exception, this.ʻ.ˎ, rz.RESOURCE_DISK_CACHE);
    }
}
